package app.k.com.kframedemo;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.viewplug.view.swap.WResideView;

/**
 * Created by mac_wk on 14-12-29.
 */
public class ResideActivity extends Activity {
    private WResideView wResideView;
    private ListView listview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.reside_layout);
        wResideView = (WResideView) findViewById(R.id.reside);
        View view = findViewById(R.id.scrollview);
        wResideView.setChildView(view);
        listview = (ListView) findViewById(R.id.listview);
        listview.setAdapter(new BaseAdapter() {
            @Override
            public int getCount() {
                return 20;
            }

            @Override
            public Object getItem(int position) {
                return null;
            }

            @Override
            public long getItemId(int position) {
                return 0;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                if (convertView == null)
                    convertView = LayoutInflater.from(getApplicationContext()).inflate(android.R.layout.simple_list_item_1, null);
                TextView textView = (TextView) convertView;
                textView.setText(position + "");
                textView.setTextSize(20);
                textView.setTextColor(getResources().getColor(android.R.color.background_dark));
                return textView;
            }
        });
    }

    public void toggleMenu(View view) {
        wResideView.show();
    }
}
